#include <jni.h>
#include "cn_com_tiza_spiro_jvm_study_JNIHelloWorld.h"
#include <stdio.h>
JNIEXPORT void JNICALL Java_cn_com_tiza_spiro_jvm_study_JNIHelloWorld_hello
  (JNIEnv *env, jobject obj)
{
    printf("Hello world!!!!\n");

    int count = 0;
    while(count < 100) {
        printf("count=%d", count);
        jbyteArray jbArray = env->NewByteArray(1024L * 1024L);
        count++;

    }

    return;
}

JNIEXPORT jint JNICALL Java_cn_com_tiza_spiro_jvm_study_JNIHelloWorld_add
  (JNIEnv *env, jobject obj)
{
    // 获取class对象
    jclass clazz = env->GetObjectClass(obj);

    // 获取number属性id
    jfieldID id_num = env->GetFieldID(clazz, "number", "I");

    jint number = env->GetIntField(obj, id_num);
    printf("get number value=%d", number);

    env->SetIntField(obj, id_num, 100L);

}